package transaction

import (
	"ChainCodeProject/wallet"
	"bytes"
)

/**
 * @author: 清秋
 * @email: 15770670622
 * @datetime: 9:51 2022/4/20
 * @Description:
 */

//创建一个交易输出结构体
type Output struct {
	//币的金额
	Value uint
	//锁定脚本
	ScriptPubKey []byte
}

//判断这个交易输出是不是某个人的
func (output *Output) IsUnLock(from string) bool {
	if from == "" {
		return false
	}
	pubhash, err := wallet.GetPubHash(from)
	if err != nil {
		return false
	}
	return bytes.Compare(output.ScriptPubKey, pubhash) == 0
}
